package net.diaowen.dwsurvey.dao.impl;

import net.diaowen.common.dao.BaseDaoImpl;
import net.diaowen.dwsurvey.dao.ReportDescDao;
import org.springframework.stereotype.Repository;

import javax.management.Query;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Repository
public class ReportDescDaoImpl extends BaseDaoImpl implements ReportDescDao {
    @Override
    public String findtabletitle(String id) throws Exception{
        try{
            String sql="select report_column from t_report_desc where id =?";
            System.out.println("输出sql"+sql);
            List<Object[]> list= this.getSession().createSQLQuery(sql).setString(0,id).list();

//            for (Object[] report:list){
//
//                System.out.println(report[0].toString());
//            }
            Iterator iterator=list.iterator();
            while (iterator.hasNext()){
                return iterator.next().toString();
            }
        }catch (Exception e){
            e.printStackTrace();
        }

        return "{data:null}";
    }
}
